package com.roncoo.adminlte.util;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;

/**
 * @author zhuruhong
 *
 * 若要变更这个产生的类别注解的范本，请移至
 * 视窗 > 喜好设定 > Java > 程式码产生 > 程式码和注解
 */
public class FileUtil {
	private String filename = null;
	
	public String getFilename() {
		return filename;
	}

	public void setFilename(String filename) {
		this.filename = filename;
	}

	public void writeFileByName(String content) {
		File docFile = new File(filename);
		try {
			docFile.createNewFile();
			FileOutputStream txtfile = new FileOutputStream(docFile);
			PrintStream p = new PrintStream(txtfile);
			p.println(content);
			txtfile.close();
			p.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		FileUtil wfbn = new FileUtil();
		wfbn.setFilename("C:/title.txt");
		wfbn.writeFileByName("content");
	}
}
